package libcore.config;

import android.content.Context;
import android.content.res.Resources;
import androidx.annotation.NonNull;

public class LibConfig {

  public static final String TAG_HTTP = "TAG_HTTP";
  public static final String TAG_LOG = "TAG_LOG";

  // 全局上下文
  private static Context sContext;
  private static Callback sCallback;

  /**
   * fixme 必须先设置初始化
   */
  public static void init(@NonNull Context context, @NonNull Callback callback) {
    sContext = context;
    sCallback = callback;
  }

  public static Context getContext() {
    return sContext;
  }

  public static Resources getResources() {
    return sContext.getResources();
  }

  public static boolean isDebug() {
    return sCallback.isDebug();
  }

  public static String getBaseUrl() {
    return sCallback.getBaseUrl();
  }

  /**
   * 插件中和主工程中的实现方式不同
   */
  public interface Callback {

    boolean isDebug();

    String getBaseUrl();
  }
}
